﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.IO;
using System.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
using System.Windows.Forms;
using Growatt.OSC.Util;
using LEDVANCE.OSC.Channel;
using Oscilloscope.Adjust;
using Oscilloscope.Channel;
using Oscilloscope.ChannelBuffer;
using Oscilloscope.Curve;
using Oscilloscope.Exception;
using Oscilloscope.Util;

namespace Oscilloscope.Screen
{
    // Token: 0x02000014 RID: 20
    public class OscilloscopeScreen : UserControl, IOscilloscopeScreen
    {
        // Token: 0x060000B1 RID: 177 RVA: 0x0000613C File Offset: 0x0000433C
        protected override void Dispose(bool disposing)
        {
            if (disposing && this.components != null)
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        // Token: 0x060000B2 RID: 178 RVA: 0x0000615C File Offset: 0x0000435C
        private void InitializeComponent()
        {
            this.SuspendLayout();
            // 
            // OscilloscopeScreen
            // 
            this.AllowDrop = true;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor = System.Drawing.SystemColors.Control;
            this.Margin = new System.Windows.Forms.Padding(0);
            this.Name = "OscilloscopeScreen";
            this.Size = new System.Drawing.Size(200, 200);
            this.ResumeLayout(false);

        }
        public static Action ActionDrawCurve;

        public void DrawCurve()
        {
            SetTimePerCellGrade(13);
            Graphics graphics = this.centerDrawArea.CreateGraphics();
            graphics.SmoothingMode = SmoothingMode.HighSpeed;
            InternalUtils.DrawGrid(graphics, this.centerDrawArea.ClientSize);
            for (int i = OscilloscopeScreen.CHANNEL_COUNT - 1; i >= 0; i--)
            {
                if (this.channels[i].isEnable)
                {
                    //var sjson = File.ReadAllText($"curveGenerator{i+1}.json");
                    //var str = DuiJsonHelper.JsonToObject<List<Oscilloscope.Curve.Curve>>(sjson);
                    //this.channels[i].channel.DrawCurveUse(graphics, str.ToArray());


                }
            }
            this.DrawMPosArrow(graphics, this.centerDrawArea.ClientSize); //画箭头
            this.DrawCursor(graphics);
        }

        // Token: 0x14000001 RID: 1
        // (add) Token: 0x060000B3 RID: 179 RVA: 0x000061DB File Offset: 0x000043DB
        // (remove) Token: 0x060000B4 RID: 180 RVA: 0x000061F4 File Offset: 0x000043F4
        public event ChannelPropertyChangedEventHandler ChannelPropertyChanged;

        // Token: 0x060000B5 RID: 181 RVA: 0x00006210 File Offset: 0x00004410
        public OscilloscopeScreen()
        {
            this.InitializeComponent();
            this.timer = new VoscRefreshTimer(this);
            this.channelBufferMgr = new ChannelBufferManager(OscilloscopeScreen.CHANNEL_COUNT);
            this.mouseTool = new CurveMoveMouseTool();
            this.centerDrawArea = new DrawArea();
            this.topDrawArea = new DrawArea();
            this.bottomDrawArea = new DrawArea();
            this.leftDrawArea = new DrawArea();
            this.rightDrawArea = new DrawArea();
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                this.channels[i] = new OscilloscopeScreen.ChannelContainer();
                this.channels[i].channel = ChannelFactory.GetChannel(i + 1, this);
                this.channels[i].isEnable = false;
            }
            this.isFreezeHorizontalMove = false;
            this.isFreezeVerticalMove = false;
            this.isCursorsFunctionEnable = false;
            this.cursorXMoveMode = CursorMoveMode._1;
            this.cursorYMoveMode = CursorMoveMode._2;
            this.AllowDrop = true;
            this.Initialize();
            //SaveValue += GetCurrentChannelData;
            ActionDrawCurve += DrawCurve;
            this.Load += OscilloscopeScreen_Load;

            centerDrawArea.AllowDrop = true;
            centerDrawArea.DragDrop += OscilloscopeScreen_DragDrop;
            centerDrawArea.DragEnter += OscilloscopeScreen_DragEnter;
        }

        public static Action<String> ShowPath;

        private void OscilloscopeScreen_DragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                e.Effect = DragDropEffects.Link;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }

        }

        private void OscilloscopeScreen_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                string path = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
                ShowPath?.Invoke(path);
            }
            catch (System.Exception)
            {

            }
        }

        public static Func<string, (string, int)> SaveValue;

        // Token: 0x060000B6 RID: 182 RVA: 0x00006318 File Offset: 0x00004518
        private void Initialize()
        {
            base.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            this.centerDrawArea.Initialize();
            this.topDrawArea.Initialize();
            this.bottomDrawArea.Initialize();
            this.leftDrawArea.Initialize();
            this.rightDrawArea.Initialize();
        }
        public static Action<int> leftDrawAreaDrwaVPosArrow;
        public static Action<int, double> leftDrawAreaDrwaVPosArrowWithDouble;
        public static Action<List<string>, List<(string, Color)>> ShowDatasChannel;
        // Token: 0x060000B7 RID: 183 RVA: 0x00006368 File Offset: 0x00004568
        private void OscilloscopeScreen_Load(object sender, EventArgs e)
        {
            this.BackColor = OscilloscopeScreen.OSCILLOSCOPE_SCREEN_BACKGROUND;
            base.Resize += this.OscilloscopeScreen_Resize;
            this.centerDrawArea.Location = new Point(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top);
            this.centerDrawArea.Size = new Size(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right, base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom);
            this.centerDrawArea.BackColor = OscilloscopeScreen.CENTER_DRAW_AREA_BACKGROUND;
            this.centerDrawArea.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            this.centerDrawArea.MouseDown += this.centerDrawArea_MouseDown;
            this.centerDrawArea.MouseMove += this.centerDrawArea_MouseMove;
            this.centerDrawArea.MouseUp += this.centerDrawArea_MouseUp;
            this.centerDrawArea.Paint += this.centerDrawArea_Paint;
            base.Controls.Add(this.centerDrawArea);
            this.topDrawArea.Location = new Point(0, 0);
            this.topDrawArea.Size = new Size(base.ClientSize.Width, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top);
            this.topDrawArea.BackColor = OscilloscopeScreen.CENTER_DRAW_AREA_BACKGROUND;
            this.topDrawArea.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
            this.topDrawArea.Paint += this.topDrawArea_Paint;
            base.Controls.Add(this.topDrawArea);
            this.bottomDrawArea.Location = new Point(0, base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom);
            this.bottomDrawArea.Size = new Size(base.ClientSize.Width, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom);
            this.bottomDrawArea.BackColor = OscilloscopeScreen.CENTER_DRAW_AREA_BACKGROUND;
            this.bottomDrawArea.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            this.bottomDrawArea.Paint += this.bottomDrawArea_Paint;
            base.Controls.Add(this.bottomDrawArea);
            this.leftDrawArea.Location = new Point(0, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top);
            this.leftDrawArea.Size = new Size(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left, base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom);
            this.leftDrawArea.BackColor = OscilloscopeScreen.CENTER_DRAW_AREA_BACKGROUND;
            this.leftDrawArea.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left);
            this.leftDrawArea.Paint += this.leftDrawArea_Paint;
            leftDrawAreaDrwaVPosArrow += (int index) =>
            {
                SetChannelBaseLineValue(index, 0);
                if (this.ChannelPropertyChanged != null)
                {
                    this.ChannelPropertyChanged(index, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[index - 1].channel.GetBaseLineValue()));
                }
            };
            leftDrawAreaDrwaVPosArrowWithDouble += (int index, double value) =>
            {
                SetChannelBaseLineValue(index, value);
                if (this.ChannelPropertyChanged != null)
                {
                    this.ChannelPropertyChanged(index, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[index - 1].channel.GetBaseLineValue()));
                }
            };
            base.Controls.Add(this.leftDrawArea);
            this.rightDrawArea.Location = new Point(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top);
            this.rightDrawArea.Size = new Size(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right, base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom);
            this.rightDrawArea.BackColor = OscilloscopeScreen.CENTER_DRAW_AREA_BACKGROUND;
            this.rightDrawArea.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right);
            base.Controls.Add(this.rightDrawArea);
            this.AdjustTimeRefValueAccordChannelBuffers();
            this.SetWindowCenterTimeInternal(this.timeReferenceValue);
            this.SetTimeSpanToAllChannel();
            this.SetTimePerCellGradeToAllChannel();
            this.SetCanvasSizeToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.lastCenterDrawAreaWidth = this.centerDrawArea.ClientSize.Width;
            this.cursorX1Pos = (float)this.centerDrawArea.ClientSize.Width / 4f;
            this.cursorX2Pos = 3f * ((float)this.centerDrawArea.ClientSize.Width / 4f);
            this.lastCenterDrawAreaHeight = this.centerDrawArea.ClientSize.Height;
            this.cursorY1Pos = (float)this.centerDrawArea.ClientSize.Height / 4f;
            this.cursorY2Pos = 3f * ((float)this.centerDrawArea.ClientSize.Height / 4f);
        }
        // Token: 0x060000B8 RID: 184 RVA: 0x00006824 File Offset: 0x00004A24
        public void RefreshData()
        {
            base.Invoke(new OscilloscopeScreen.RefreshUiTimeoutHandler(this.RefreshUI));
        }

        // Token: 0x060000B9 RID: 185 RVA: 0x00006839 File Offset: 0x00004A39
        private void RefreshUI()
        {
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
        }

        // Token: 0x060000BA RID: 186 RVA: 0x0000684C File Offset: 0x00004A4C
        public IChannelBufferManager GetChannelBufferManager()
        {
            return this.channelBufferMgr;
        }
        /// <summary>
        /// 设置每个Chanel最大容量
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="channelBuffer"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void SetChannelBuffer(int channelSN, IChannelBuffer channelBuffer)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channelBufferMgr.SetChannelBuffer(channelSN, channelBuffer);
            this.channels[channelSN - 1].channel.RefreshChannelBuffer();
            this.AdjustTimeRefValueAccordChannelBuffers();
            this.SetWindowCenterTimeInternal(this.timeReferenceValue);
            this.SetTimeSpanToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
            this.leftDrawArea.Refresh();
        }

        /// <summary>
        /// chanel可见
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="enable"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void EnableChannel(int channelSN, bool enable)
        {

            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].isEnable = enable;

            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
            this.leftDrawArea.Refresh();
        }

        // Token: 0x060000BD RID: 189 RVA: 0x00006924 File Offset: 0x00004B24
        public void SetChannelValuePerCellGrade(int channelSN, int valuePerCellGrade)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.SetValuePerCellGrade(valuePerCellGrade);
            if (this.ChannelPropertyChanged != null)
            {
                this.ChannelPropertyChanged(channelSN, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[channelSN - 1].channel.GetBaseLineValue()));
            }
            this.NotifyChannelToPreparePointOfCurve(channelSN);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }
        // Token: 0x060000BD RID: 189 RVA: 0x00006924 File Offset: 0x00004B24
        public void SetChannelOffset(int channelSN, double SetOffset)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            SetOffset = 0;
            this.channels[channelSN - 1].channel.SetOffset(SetOffset);
            if (this.ChannelPropertyChanged != null)
            {
                this.ChannelPropertyChanged(channelSN, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[channelSN - 1].channel.GetBaseLineValue()));
            }
            this.NotifyChannelToPreparePointOfCurve(channelSN);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }
        /// <summary>
        /// 设置箭头所在的位置
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="value"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void SetChannelBaseLineValue(int channelSN, double value)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.SetBaseLineValue(value);
            this.NotifyChannelToPreparePointOfCurve(channelSN);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
                this.leftDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }

        /// <summary>
        /// 变更Channel的颜色
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="color"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void SetChannelColor(int channelSN, Color color)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.SetColor(color);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
                this.leftDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }

        // Token: 0x060000C0 RID: 192 RVA: 0x00006A94 File Offset: 0x00004C94
        public void SetChannelLineWidth(int channelSN, float lineWidth)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.SetLineWidth(lineWidth);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
            }
        }

        // Token: 0x060000C1 RID: 193 RVA: 0x00006AE4 File Offset: 0x00004CE4
        public void SetChannelBitMask(int channelSN, ushort bitMask)
        {
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.SetBitMask(bitMask);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
                this.leftDrawArea.Refresh();
            }
        }

        /// <summary>
        /// 向上移动曲线
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="movingTimes"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void MoveChannelWaveUp(int channelSN, int movingTimes)
        {
            if (this.isCursorsFunctionEnable)
            {
                if (this.cursorYMoveMode == CursorMoveMode._1)
                {
                    this.cursorY1Pos -= (float)movingTimes;
                    if (this.cursorY1Pos < 0f)
                    {
                        this.cursorY1Pos = 0f;
                    }
                }
                else if (this.cursorYMoveMode == CursorMoveMode._2)
                {
                    this.cursorY2Pos -= (float)movingTimes;
                    if (this.cursorY2Pos < 0f)
                    {
                        this.cursorY2Pos = 0f;
                    }
                }
                else if (this.cursorYMoveMode == CursorMoveMode.Both && this.cursorY1Pos - (float)movingTimes >= 0f && this.cursorY2Pos - (float)movingTimes >= 0f)
                {
                    this.cursorY1Pos -= (float)movingTimes;
                    this.cursorY2Pos -= (float)movingTimes;
                }
                this.centerDrawArea.Refresh();
                this.bottomDrawArea.Refresh();
                return;
            }
            if (this.isFreezeVerticalMove)
            {
                return;
            }
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.MoveWaveUp(movingTimes);
            if (this.ChannelPropertyChanged != null)
            {
                this.ChannelPropertyChanged(channelSN, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[channelSN - 1].channel.GetBaseLineValue()));
            }
            this.NotifyChannelToPreparePointOfCurve(channelSN);
            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
                this.leftDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }

        /// <summary>
        /// 向下移动曲线
        /// </summary>
        /// <param name="channelSN"></param>
        /// <param name="movingTimes"></param>
        /// <exception cref="NoSuchChannelException"></exception>
        public void MoveChannelWaveDown(int channelSN, int movingTimes)
        {
            if (this.isCursorsFunctionEnable)
            {
                if (this.cursorYMoveMode == CursorMoveMode._1)
                {
                    this.cursorY1Pos += (float)movingTimes;
                    if (this.cursorY1Pos >= (float)this.centerDrawArea.ClientSize.Height)
                    {
                        this.cursorY1Pos = (float)(this.centerDrawArea.ClientSize.Height - 1);
                    }
                }
                else if (this.cursorYMoveMode == CursorMoveMode._2)
                {
                    this.cursorY2Pos += (float)movingTimes;
                    if (this.cursorY2Pos >= (float)this.centerDrawArea.ClientSize.Height)
                    {
                        this.cursorY2Pos = (float)(this.centerDrawArea.ClientSize.Height - 1);
                    }
                }
                else if (this.cursorYMoveMode == CursorMoveMode.Both && this.cursorY1Pos + (float)movingTimes < (float)this.centerDrawArea.ClientSize.Height && this.cursorY2Pos + (float)movingTimes < (float)this.centerDrawArea.ClientSize.Height)
                {
                    this.cursorY1Pos += (float)movingTimes;
                    this.cursorY2Pos += (float)movingTimes;
                }
                this.centerDrawArea.Refresh();
                this.bottomDrawArea.Refresh();
                return;
            }
            if (this.isFreezeVerticalMove)
            {
                return;
            }
            if (channelSN < 1 || channelSN > OscilloscopeScreen.CHANNEL_COUNT)
            {
                throw new NoSuchChannelException();
            }
            this.channels[channelSN - 1].channel.MoveWaveDown(movingTimes);
            if (this.ChannelPropertyChanged != null)
            {
                this.ChannelPropertyChanged(channelSN, new ChannelPropertyChangedEventArgs(ChannelProperty.ChannelVerPos, this.channels[channelSN - 1].channel.GetBaseLineValue()));
            }
            this.NotifyChannelToPreparePointOfCurve(channelSN);

            if (this.channels[channelSN - 1].isEnable)
            {
                this.centerDrawArea.Refresh();
                this.leftDrawArea.Refresh();
            }
            this.bottomDrawArea.Refresh();
        }

        public void SetTimeReferenceValue(double value)
        {
            if (value < 0.0)
            {
                throw new ArgumentOutOfRangeException();
            }
            this.timeReferenceValue = value;
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
        }

        public void SetWindowCenterTime(double value)
        {
            this.SetWindowCenterTimeInternal(value);
            this.SetTimeSpanToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
        }

        private void SetWindowCenterTimeInternal(double value)
        {
            if (value < 0.0)
            {
                throw new ArgumentOutOfRangeException();
            }
            this.windowCenterTime = value;
            this.AdjustWindowCenterTime();
        }

        public void SetTimePerCellGrade(int timePerCellGrade)
        {


            if (timePerCellGrade < 0 || timePerCellGrade >= TimePerCellAdjustGrade.Instance.GradeCount)
            {
                throw new NotSupportGradeException();
            }
            this.timeLengthPerCellGrade = timePerCellGrade;
            this.AdjustWindowCenterTime();
            this.SetTimePerCellGradeToAllChannel();
            this.SetTimeSpanToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
            this.bottomDrawArea.Refresh();
        }

        // Token: 0x060000C8 RID: 200 RVA: 0x00006F83 File Offset: 0x00005183
        public int GetTimePerCellGrade()
        {
            return this.timeLengthPerCellGrade;
        }

        /// <summary>
        /// 向左边移动
        /// </summary>
        /// <param name="movingTimes"></param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public void MoveWindowLeft(int movingTimes)
        {
            if (this.isCursorsFunctionEnable)
            {
                if (this.cursorXMoveMode == CursorMoveMode._1)
                {
                    this.cursorX1Pos += (float)movingTimes;
                    if (this.cursorX1Pos >= (float)this.centerDrawArea.ClientSize.Width)
                    {
                        this.cursorX1Pos = (float)(this.centerDrawArea.ClientSize.Width - 1);
                    }
                }
                else if (this.cursorXMoveMode == CursorMoveMode._2)
                {
                    this.cursorX2Pos += (float)movingTimes;
                    if (this.cursorX2Pos >= (float)this.centerDrawArea.ClientSize.Width)
                    {
                        this.cursorX2Pos = (float)(this.centerDrawArea.ClientSize.Width - 1);
                    }
                }
                else if (this.cursorXMoveMode == CursorMoveMode.Both && this.cursorX1Pos + (float)movingTimes < (float)this.centerDrawArea.ClientSize.Width && this.cursorX2Pos + (float)movingTimes < (float)this.centerDrawArea.ClientSize.Width)
                {
                    this.cursorX1Pos += (float)movingTimes;
                    this.cursorX2Pos += (float)movingTimes;
                }
                this.centerDrawArea.Refresh();
                this.bottomDrawArea.Refresh();
                return;
            }
            if (this.isFreezeHorizontalMove)
            {
                return;
            }
            if (movingTimes < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            for (int i = 0; i < movingTimes; i++)
            {
                double num = Math.Abs(this.windowCenterTime - this.timeReferenceValue);
                double windowCenterTimeInternal;
                if (InternalUtils.IsXbeDivByYwithNoRemainder(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade)))
                {
                    windowCenterTimeInternal = this.windowCenterTime - TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade);
                }
                else if (this.windowCenterTime < this.timeReferenceValue)
                {
                    windowCenterTimeInternal = this.timeReferenceValue - InternalUtils.GetIntegralMultipleOfStepBaseValueOf(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade), true);
                }
                else
                {
                    windowCenterTimeInternal = this.timeReferenceValue + InternalUtils.GetIntegralMultipleOfStepBaseValueOf(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade), false);
                }
                this.SetWindowCenterTimeInternal(windowCenterTimeInternal);
            }
            this.SetTimeSpanToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
        }

        /// <summary>
        /// 向右边移动
        /// </summary>
        /// <param name="movingTimes"></param>
        /// <exception cref="ArgumentOutOfRangeException"></exception>
        public void MoveWindowRight(int movingTimes)
        {
            if (this.isCursorsFunctionEnable)
            {
                if (this.cursorXMoveMode == CursorMoveMode._1)
                {
                    this.cursorX1Pos -= (float)movingTimes;
                    if (this.cursorX1Pos < 0f)
                    {
                        this.cursorX1Pos = 0f;
                    }
                }
                else if (this.cursorXMoveMode == CursorMoveMode._2)
                {
                    this.cursorX2Pos -= (float)movingTimes;
                    if (this.cursorX2Pos < 0f)
                    {
                        this.cursorX2Pos = 0f;
                    }
                }
                else if (this.cursorXMoveMode == CursorMoveMode.Both && this.cursorX1Pos - (float)movingTimes >= 0f && this.cursorX2Pos - (float)movingTimes >= 0f)
                {
                    this.cursorX1Pos -= (float)movingTimes;
                    this.cursorX2Pos -= (float)movingTimes;
                }
                this.centerDrawArea.Refresh();
                this.bottomDrawArea.Refresh();
                return;
            }
            if (this.isFreezeHorizontalMove)
            {
                return;
            }
            if (movingTimes < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            for (int i = 0; i < movingTimes; i++)
            {
                double num = Math.Abs(this.windowCenterTime - this.timeReferenceValue);
                double windowCenterTimeInternal;
                if (InternalUtils.IsXbeDivByYwithNoRemainder(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade)))
                {
                    windowCenterTimeInternal = this.windowCenterTime + TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade);
                }
                else if (this.windowCenterTime < this.timeReferenceValue)
                {
                    windowCenterTimeInternal = this.timeReferenceValue - InternalUtils.GetIntegralMultipleOfStepBaseValueOf(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade), false);
                }
                else
                {
                    windowCenterTimeInternal = this.timeReferenceValue + InternalUtils.GetIntegralMultipleOfStepBaseValueOf(num, TimePerCellAdjustGrade.Instance.GetStepOfGrade(this.timeLengthPerCellGrade), true);
                }
                this.SetWindowCenterTimeInternal(windowCenterTimeInternal);
            }
            this.SetTimeSpanToAllChannel();
            this.NotifyChannelToPrepareDataOfCurve();
            this.centerDrawArea.Refresh();
            this.topDrawArea.Refresh();
        }

        public void StartRefreshData()
        {
            this.channelBufferMgr.RecoverAddChannelData();
            this.timer.Start();
        }

        public void StopRefreshData()
        {
            this.channelBufferMgr.StopAddChannelData();
            this.timer.Stop();
        }

        public void SetHorizontalMoveFreeze(bool isFreeze)
        {
            this.isFreezeHorizontalMove = isFreeze;
        }

        public void SetVerticalMoveFreeze(bool isFreeze)
        {
            this.isFreezeVerticalMove = isFreeze;
        }

        public void SetCursorsFunction(bool isEnable)
        {
            this.isCursorsFunctionEnable = isEnable;
            this.centerDrawArea.Refresh();
            this.bottomDrawArea.Refresh();
        }

        public void SetCursorXMoveMode(CursorMoveMode moveMode)
        {
            this.cursorXMoveMode = moveMode;
        }

        public void SetCursorYMoveMode(CursorMoveMode moveMode)
        {
            this.cursorYMoveMode = moveMode;
        }

        public void SetverVerPosAdjustChannelSN(int channelSN)
        {
            if (channelSN < 1 || channelSN > 10)
            {
                throw new NoSuchChannelException();
            }
            this.verPosAdjustChannelSN = channelSN;
            this.bottomDrawArea.Refresh();
        }

        private void centerDrawArea_MouseUp(object sender, MouseEventArgs e)
        {
            this.mouseTool.OnMouseUp((DrawArea)sender, e, this);
        }

        private void centerDrawArea_MouseMove(object sender, MouseEventArgs e)
        {
            this.mouseTool.OnMouseMove((DrawArea)sender, e, this);
        }

        private void centerDrawArea_MouseDown(object sender, MouseEventArgs e)
        {
            this.mouseTool.OnMouseDown((DrawArea)sender, e, this);
        }

        internal void MoveSelectedChannelWaveUp(int movingTimes)
        {
            this.MoveChannelWaveUp(this.verPosAdjustChannelSN, movingTimes);
        }

        internal void MoveSelectedChannelWaveDown(int movingTimes)
        {
            this.MoveChannelWaveDown(this.verPosAdjustChannelSN, movingTimes);
        }

        /// <summary>
        /// 显示曲线点
        /// </summary>
        /// <param name="mousePosition"></param>
        internal void ShowCurvePointValue(Point mousePosition)
        {
            if (!this.channels[this.verPosAdjustChannelSN - 1].isEnable)
            {
                this.isNeedShowDataOfMousePoint = false;
            }
            else
            {
                double num = 10.0 * TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade);
                double mouseMoment = this.windowCenterTime - num / 2.0 + (double)mousePosition.X / (double)this.centerDrawArea.ClientSize.Width * num;

                this.isNeedShowDataOfMousePoint = this.channels[this.verPosAdjustChannelSN - 1].channel.GetDataFromChannelBuffer(mouseMoment, mousePosition, ref this.dataOfMousePoint, ref this.isDataFromInterpolation);
            }
            this.bottomDrawArea.Refresh();
        }

        internal void RangingStart()
        {
            this.rangingEnabled = true;
            this.rangingMoffset = 0;
            this.rangingVoffset = 0;
            this.bottomDrawArea.Refresh();
        }

        // Token: 0x060000DA RID: 218 RVA: 0x0000756A File Offset: 0x0000576A
        internal void Ranging(int mOffset, int vOffset)
        {
            this.rangingMoffset = mOffset;
            this.rangingVoffset = vOffset;
            this.bottomDrawArea.Refresh();
        }

        internal void RangingStop()
        {
            this.rangingEnabled = false;
            this.bottomDrawArea.Refresh();
        }

        private void OscilloscopeScreen_Resize(object sender, EventArgs e)
        {
            this.SetCanvasSizeToAllChannel();
            this.NotifyChannelToPreparePointOfCurve();
            this.cursorX1Pos = this.cursorX1Pos / (float)this.lastCenterDrawAreaWidth * (float)this.centerDrawArea.ClientSize.Width;
            if (this.cursorX1Pos < 0f)
            {
                this.cursorX1Pos = 0f;
            }
            else if (this.cursorX1Pos >= (float)this.centerDrawArea.ClientSize.Width)
            {
                this.cursorX1Pos = (float)(this.centerDrawArea.ClientSize.Width - 1);
            }
            this.cursorX2Pos = this.cursorX2Pos / (float)this.lastCenterDrawAreaWidth * (float)this.centerDrawArea.ClientSize.Width;
            if (this.cursorX2Pos < 0f)
            {
                this.cursorX2Pos = 0f;
            }
            else if (this.cursorX2Pos >= (float)this.centerDrawArea.ClientSize.Width)
            {
                this.cursorX2Pos = (float)(this.centerDrawArea.ClientSize.Width - 1);
            }
            this.lastCenterDrawAreaWidth = this.centerDrawArea.ClientSize.Width;
            this.cursorY1Pos = this.cursorY1Pos / (float)this.lastCenterDrawAreaHeight * (float)this.centerDrawArea.ClientSize.Height;
            if (this.cursorY1Pos < 0f)
            {
                this.cursorY1Pos = 0f;
            }
            else if (this.cursorY1Pos >= (float)this.centerDrawArea.Height)
            {
                this.cursorY1Pos = (float)(this.centerDrawArea.ClientSize.Height - 1);
            }
            this.cursorY2Pos = this.cursorY2Pos / (float)this.lastCenterDrawAreaHeight * (float)this.centerDrawArea.ClientSize.Height;
            if (this.cursorY2Pos < 0f)
            {
                this.cursorY2Pos = 0f;
            }
            else if (this.cursorY2Pos >= (float)this.centerDrawArea.Height)
            {
                this.cursorY2Pos = (float)(this.centerDrawArea.ClientSize.Height - 1);
            }
            this.lastCenterDrawAreaHeight = this.centerDrawArea.ClientSize.Height;
            this.Refresh();
        }

        // Token: 0x060000DD RID: 221 RVA: 0x000077D4 File Offset: 0x000059D4
        private void centerDrawArea_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
            InternalUtils.DrawGrid(e.Graphics, this.centerDrawArea.ClientSize);
            for (int i = OscilloscopeScreen.CHANNEL_COUNT - 1; i >= 0; i--)
            {
                if (this.channels[i].isEnable)
                {
                    this.channels[i].channel.DrawCurve(e.Graphics);
                }
            }
            this.DrawMPosArrow(e.Graphics, this.centerDrawArea.ClientSize); //画箭头
            this.DrawCursor(e.Graphics);
        }

        // Token: 0x060000DE RID: 222 RVA: 0x0000785F File Offset: 0x00005A5F
        private void topDrawArea_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
            this.DrawMText(e.Graphics);
            this.DrawMPosText(e.Graphics);
        }

        // Token: 0x060000DF RID: 223 RVA: 0x00007888 File Offset: 0x00005A88
        private void bottomDrawArea_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
            this.DrawDataOfMousePoint(e.Graphics);
            this.DrawRanging(e.Graphics);
            this.DrawVPosText(e.Graphics);
            this.DrawVGText(e.Graphics);
            this.DrawCursorText(e.Graphics);
            this.DrawDataOfMousePoints(e.Graphics, channelData);

        }

        // Token: 0x060000E0 RID: 224 RVA: 0x000078DD File Offset: 0x00005ADD
        private void leftDrawArea_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
            this.DrwaVPosArrow(e.Graphics);
        }

        // Token: 0x060000E1 RID: 225 RVA: 0x000078F8 File Offset: 0x00005AF8
        private void DrawMPosText(Graphics g)
        {
            g.DrawString("M Pos:" + InternalUtils.GetDisplayStrOfValue(this.windowCenterTime - this.timeReferenceValue) + "s", OscilloscopeScreen.DEFAULT_M_FONT, Brushes.White, (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + (float)this.centerDrawArea.ClientSize.Width * 0.7f, (float)(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - 18));
            g.DrawString(string.Concat(new string[]
            {
                "TMB:",
                InternalUtils.GetDisplayStrOfValue(this.allChannelBufferMaxTotalTime),
                "s  BM:",
                InternalUtils.GetDisplayStrOfValue(this.timeReferenceValue),
                "s"
            }), OscilloscopeScreen.DEFAULT_M_FONT, Brushes.White, (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left, (float)(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - 18));
        }

        // Token: 0x060000E2 RID: 226 RVA: 0x000079E4 File Offset: 0x00005BE4
        private void DrawMText(Graphics g)
        {

            g.DrawString("M " + TimePerCellAdjustGrade.Instance.GetDisplayStrOfGrade(this.timeLengthPerCellGrade) + "s", OscilloscopeScreen.DEFAULT_M_FONT, Brushes.White, (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + (float)this.centerDrawArea.ClientSize.Width * 0.5f, (float)(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - 18));
        }

        // Token: 0x060000E3 RID: 227 RVA: 0x00007A5C File Offset: 0x00005C5C
        private void DrawMPosArrow(Graphics g, Size size)
        {
            float num = (float)((this.timeReferenceValue - (this.windowCenterTime - TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 5.0)) / (TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 10.0) * (double)size.Width);
            float y = 0f;
            if (num > (float)size.Width)
            {
                InternalUtils.DrawArrow(g, new RectangleF((float)(size.Width - 10), y, 10f, 10f), Cursors.PanEast, Brushes.White);
                return;
            }
            if (num < 0f)
            {
                InternalUtils.DrawArrow(g, new RectangleF(0f, y, 10f, 10f), Cursors.PanWest, Brushes.White);
                return;
            }
            InternalUtils.DrawArrow(g, new RectangleF(num - 5f, y, 10f, 10f), Cursors.PanSouth, Brushes.White);
        }

        // Token: 0x060000E4 RID: 228 RVA: 0x00007B50 File Offset: 0x00005D50
        private void DrawCursor(Graphics g)
        {
            if (this.isCursorsFunctionEnable)
            {
                Pen pen = new Pen(Color.White, 1f);
                pen.DashStyle = DashStyle.Dash;
                g.DrawLine(pen, new Point((int)this.cursorX1Pos, 0), new Point((int)this.cursorX1Pos, this.centerDrawArea.ClientSize.Height));
                pen.DashStyle = DashStyle.DashDot;
                g.DrawLine(pen, new Point((int)this.cursorX2Pos, 0), new Point((int)this.cursorX2Pos, this.centerDrawArea.ClientSize.Height));
                pen.DashStyle = DashStyle.DashDotDot;
                g.DrawLine(pen, new Point(0, (int)this.cursorY1Pos), new Point(this.centerDrawArea.ClientSize.Width, (int)this.cursorY1Pos));
                pen.DashStyle = DashStyle.Dot;
                g.DrawLine(pen, new Point(0, (int)this.cursorY2Pos), new Point(this.centerDrawArea.ClientSize.Width, (int)this.cursorY2Pos));
                pen.Dispose();
            }
        }

        // Token: 0x060000E5 RID: 229 RVA: 0x00007C68 File Offset: 0x00005E68
        private void DrawVPosText(Graphics g)
        {
            try
            {
                var pos = InternalUtils.GetDisplayStrOfValue(this.channels[this.verPosAdjustChannelSN - 1].channel.GetBaseLineValue());

                SolidBrush solidBrush = new SolidBrush(this.channels[this.verPosAdjustChannelSN - 1].channel.GetColor());
                g.DrawString("CH" + this.verPosAdjustChannelSN.ToString()
                    + " V Pos:"
                    + InternalUtils.GetDisplayStrOfValue(this.channels[this.verPosAdjustChannelSN - 1].channel.GetBaseLineValue()), OscilloscopeScreen.DEFAULT_V_P_FONT, solidBrush, 0f, 0f);
                solidBrush.Dispose();
            }
            catch (System.Exception ex)
            {

            }

        }

        // Token: 0x060000E6 RID: 230 RVA: 0x00007CE8 File Offset: 0x00005EE8
        private void DrawRanging(Graphics g)
        {
            if (!this.rangingEnabled)
            {
                return;
            }
            double value = TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 10.0 * ((double)this.rangingMoffset / (double)(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right));
            double value2 = ValuePerCellAdjustGrade.Instance.GetValueOfGrade(this.channels[this.verPosAdjustChannelSN - 1].channel.GetValuePerCellGrade()) * 8.0 * ((double)this.rangingVoffset / (double)(base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom));
            float x = (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + (float)(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right) * 0.5f;
            float y = 0f;
            SolidBrush solidBrush = new SolidBrush(this.channels[this.verPosAdjustChannelSN - 1].channel.GetColor());
            g.DrawString(string.Concat(new string[]
            {
                "CH",
                this.verPosAdjustChannelSN.ToString(),
                " V Offset:",
                InternalUtils.GetDisplayStrOfValue(value2),
                " M Offset:",
                InternalUtils.GetDisplayStrOfValue(value),
                "s"
            }), OscilloscopeScreen.DEFAULT_V_P_FONT, solidBrush, x, 500);

            solidBrush.Dispose();
        }

        // Token: 0x060000E7 RID: 231 RVA: 0x00007E90 File Offset: 0x00006090
        private void DrawDataOfMousePoint(Graphics g)
        {
            if (!this.isNeedShowDataOfMousePoint)
            {
                return;
            }
            float x = (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + (float)(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right) * 0.2f;
            float y = 0f;
            SolidBrush solidBrush = new SolidBrush(this.channels[this.verPosAdjustChannelSN - 1].channel.GetColor());
            var hexBinarystr = string.Empty;
            hexBinarystr = $"{Environment.NewLine}hex:0x{Convert.ToInt32(dataOfMousePoint).ToString("X")} {Environment.NewLine}b:0b{Convert.ToString(Convert.ToInt32(dataOfMousePoint), 2)}";




            //g.DrawString(string.Concat(new string[]
            //{
            //    "CH",
            //    this.verPosAdjustChannelSN.ToString(),
            //    $":Data:",
            //    InternalUtils.GetDisplayStrOfValue(this.dataOfMousePoint),
            //    this.isDataFromInterpolation ? " (I)" : "",
            //    hexBinarystr,

            //}), OscilloscopeScreen.DEFAULT_V_P_FONT, solidBrush, x+78, y+2);


            solidBrush.Dispose();

            solidBrush.Dispose();
        }

        // Token: 0x060000E8 RID: 232 RVA: 0x00007F7C File Offset: 0x0000617C
        private void DrawCursorText(Graphics g)
        {
            if (!this.isCursorsFunctionEnable)
            {
                return;
            }
            double num = TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 10.0 / (double)(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right);
            double num2 = (double)(this.cursorX1Pos - (float)this.centerDrawArea.ClientSize.Width / 2f) * num + this.windowCenterTime - this.timeReferenceValue;
            double num3 = (double)(this.cursorX2Pos - (float)this.centerDrawArea.ClientSize.Width / 2f) * num + this.windowCenterTime - this.timeReferenceValue;
            double value = num3 - num2;
            SolidBrush solidBrush = new SolidBrush(this.channels[this.verPosAdjustChannelSN - 1].channel.GetColor());
            g.DrawString(string.Format("X1 = {0}  X2 = {1}  ΔX = {2}", InternalUtils.GetDisplayStrOfValue(num2) + "s", InternalUtils.GetDisplayStrOfValue(num3) + "s", InternalUtils.GetDisplayStrOfValue(value) + "s"), OscilloscopeScreen.DEFAULT_V_P_FONT, solidBrush, 0f, 20f);
            double num4 = ValuePerCellAdjustGrade.Instance.GetValueOfGrade(this.channels[this.verPosAdjustChannelSN - 1].channel.GetValuePerCellGrade()) * 8.0 / (double)this.centerDrawArea.ClientSize.Height;
            double num5 = (double)((int)this.channels[this.verPosAdjustChannelSN - 1].channel.GetBaseLinePos() - (int)this.cursorY1Pos) * num4;
            double num6 = (double)((int)this.channels[this.verPosAdjustChannelSN - 1].channel.GetBaseLinePos() - (int)this.cursorY2Pos) * num4;
            double value2 = num6 - num5;
            g.DrawString(string.Format("Y1({3}) = {0}  Y2({3}) = {1}  ΔY({3}) = {2}", new object[]
            {
                InternalUtils.GetDisplayStrOfValue(num5),
                InternalUtils.GetDisplayStrOfValue(num6),
                InternalUtils.GetDisplayStrOfValue(value2),
                this.verPosAdjustChannelSN.ToString()
            }), OscilloscopeScreen.DEFAULT_V_P_FONT, solidBrush, (float)(OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + this.centerDrawArea.ClientSize.Width / 2), 20f);
            solidBrush.Dispose();
        }

        // Token: 0x060000E9 RID: 233 RVA: 0x000081DC File Offset: 0x000063DC
        private void DrawVGText(Graphics g)
        {
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                SolidBrush solidBrush = new SolidBrush(this.channels[i].channel.GetColor());
                g.DrawString("CH" + (i + 1).ToString() + " " + ValuePerCellAdjustGrade.Instance.GetDisplayStrOfGrade(this.channels[i].channel.GetValuePerCellGrade()), OscilloscopeScreen.DEFAULT_V_G_FONT, solidBrush, (float)(i * 55), 40);
                solidBrush.Dispose();
            }
        }

        // Token: 0x060000EA RID: 234 RVA: 0x00008264 File Offset: 0x00006464
        private void DrwaVPosArrow(Graphics g)
        {
            for (int i = OscilloscopeScreen.CHANNEL_COUNT - 1; i >= 0; i--)
            {
                if (this.channels[i].isEnable)
                {

                    this.channels[i].channel.DrawVPosArrow(g, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left,
                        base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom,
                        OscilloscopeScreen.DEFAULT_V_P_FONT);
                }
            }
        }

        private void DrwaSelectVPosArrow(Graphics g, int index)
        {

            for (int i = OscilloscopeScreen.CHANNEL_COUNT - 1; i >= 0; i--)
            {
                if (this.channels[i].isEnable)
                {
                    this.channels[i].channel.SetBaseLineValue(0); //设置说平

                    this.channels[i].channel.DrawVPosArrow(g, OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left,
                        base.ClientSize.Height - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Top - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Bottom,
                        OscilloscopeScreen.DEFAULT_V_P_FONT);
                }
            }





        }

        // Token: 0x060000EB RID: 235 RVA: 0x000082E4 File Offset: 0x000064E4
        private void AdjustTimeRefValueAccordChannelBuffers()
        {
            double num = -1.0;
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                if (this.channels[i].isEnable && this.channels[i].channel.GetChannelBuffer().GetTotalTime() > num)
                {
                    num = this.channels[i].channel.GetChannelBuffer().GetTotalTime();
                }
            }
            if (num > 0.0)
            {
                this.allChannelBufferMaxTotalTime = num;
                this.timeReferenceValue = num / 2.0;
            }
        }

        // Token: 0x060000EC RID: 236 RVA: 0x00008370 File Offset: 0x00006570
        private bool AdjustWindowCenterTime()
        {
            if (this.windowCenterTime - TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 5.0 < 0.0)
            {
                this.windowCenterTime = TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 5.0;
                return true;
            }

            return false;
        }

        // Token: 0x060000ED RID: 237 RVA: 0x000083D0 File Offset: 0x000065D0
        private void SetTimeSpanToAllChannel()
        {
            double startTime = this.windowCenterTime - TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 5.0;
            double endTime = this.windowCenterTime + TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade) * 5.0;
            //   Debug.WriteLine(startTime + "......" + endTime);

            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                this.channels[i].channel.SetTimeSpan(startTime, endTime);
            }
        }

        // Token: 0x060000EE RID: 238 RVA: 0x0000844C File Offset: 0x0000664C
        private void SetTimePerCellGradeToAllChannel()
        {
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                this.channels[i].channel.SetTimePerCellGrade(this.timeLengthPerCellGrade);
            }
        }

        // Token: 0x060000EF RID: 239 RVA: 0x00008484 File Offset: 0x00006684
        private void SetCanvasSizeToAllChannel()
        {
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                this.channels[i].channel.SetCanvasSize(this.centerDrawArea.ClientSize.Width, this.centerDrawArea.ClientSize.Height);
            }
        }

        // Token: 0x060000F0 RID: 240 RVA: 0x000084D9 File Offset: 0x000066D9
        private void NotifyChannelToPrepareDataOfCurve(int channelSN)
        {
            this.channels[channelSN - 1].channel.PrepareDataOfCurve();
            this.NotifyChannelToPreparePointOfCurve(channelSN);
        }

        // Token: 0x060000F1 RID: 241 RVA: 0x000084F8 File Offset: 0x000066F8
        private void NotifyChannelToPrepareDataOfCurve()
        {

            lock (this.channelBufferMgr.GetReadWriteLocker())
            {
                for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
                {
                    this.channels[i].channel.PrepareDataOfCurve();
                }
            }
            this.NotifyChannelToPreparePointOfCurve();
        }

        // Token: 0x060000F2 RID: 242 RVA: 0x00008558 File Offset: 0x00006758
        private void NotifyChannelToPreparePointOfCurve(int channelSN)
        {
            this.channels[channelSN - 1].channel.PreparePointOfCurve();
        }

        /// <summary>
        /// 
        /// </summary>
        private void NotifyChannelToPreparePointOfCurve()
        {
            Dictionary<int, List<double>> DicEveryChannelData = new Dictionary<int, List<double>>();
            try
            {
                for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
                {
                    this.channels[i].channel.PreparePointOfCurve();
                    var realVal = this.channels[i].channel.PreparePointOfGetDatas();
                    if (!DicEveryChannelData.ContainsKey(i + 1))
                    {
                        DicEveryChannelData.Add(i + 1, realVal);
                    }
                    else
                    {
                        DicEveryChannelData[i + 1].Clear();
                        DicEveryChannelData[i + 1].AddRange(realVal);
                    }
                }
            }
            catch (System.Exception)
            {

            }

        }

        public (string, int) GetCurrentChannelData(string filePath)
        {
            Dictionary<int, List<double>> DicChannelData = new Dictionary<int, List<double>>();
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                this.channels[i].channel.PreparePointOfCurve();
                var realVal = this.channels[i].channel.PreparePointOfGetDatas();
                File.WriteAllText($"curveGenerator{i + 1}.json", DuiJsonHelper.ObjectToJson(this.channels[i].channel.GetCurves()));


                if (!DicChannelData.ContainsKey(i + 1))
                {
                    DicChannelData.Add(i + 1, realVal);
                }
                else
                {
                    DicChannelData[i + 1].Clear();
                    DicChannelData[i + 1].AddRange(realVal);
                }
            }
            // 使用StringBuilder来构建CSV内容
            var csvContent = new System.Text.StringBuilder();

            // 写入CSV文件的标题行，假设通道名称为Channel1, Channel2等
            //for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            //{
            //    csvContent.Append($"Channel{i + 1},");
            //}
            //csvContent.AppendLine(); // 换行
            // 假设每个通道有相同数量的数据点，这里取一个固定的数量为例
            int dataPointCount = DicChannelData[1].Count; // 假设有100个数据点

            // 写入数据行
            for (int pointIndex = 0; pointIndex < dataPointCount; pointIndex++)
            {

                string h = "0,";
                for (int channelIndex = 0; channelIndex < OscilloscopeScreen.CHANNEL_COUNT; channelIndex++)
                {
                    var realVal = DicChannelData[channelIndex + 1][pointIndex];
                    h += ($"{realVal},");
                }
                csvContent.AppendLine(h.TrimEnd(',')); // 去掉最后一个逗号，并换行
            }
            // 将StringBuilder的内容写入CSV文件
            return (csvContent.ToString(), dataPointCount);
        }

        Dictionary<int, List<double>> DicChannelData = new Dictionary<int, List<double>>();

        List<(int ChannelNumber, double DataValue, bool IsInterpolated, Point ScreenPosition)> channelData = new List<(int ChannelNumber, double DataValue, bool IsInterpolated, Point ScreenPosition)>();


        #region MyRegion

        /// <summary>
        /// 显示所有通道的鼠标所在位置的数据值
        /// </summary>
        /// <param name="mousePosition"></param>
        internal void ShowCurvePointValues(Point mousePosition)
        {

            channelData.Clear();
            //ShowOrignalDataV0(mousePosition); //4
            for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            {
                if (this.channels[i].isEnable)
                {
                    double timeStep = 10.0 * TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade);
                    double mouseMoment = this.windowCenterTime - timeStep / 2.0 + (double)mousePosition.X / (double)this.centerDrawArea.ClientSize.Width * timeStep;

                    double dataValue = 0.0;
                    bool isInterpolated = false;

                    bool hasData = this.channels[i].channel.GetDataFromChannelBuffer(mouseMoment, mousePosition, ref dataValue, ref isInterpolated);
                    if (hasData)
                    {
                        // 计算数据值在屏幕上的Y轴位置
                        float y = this.CalculateScreenYPosition(dataValue, i);
                        channelData.Add((i + 1, dataValue, isInterpolated, new Point(mousePosition.X, (int)y)));
                    }
                }
            }
        }

        #region 显示
        void ShowOrignalDataV0(Point mousePosition)
        {

            //try
            //{
            //    // 假设 mousePosition.X 已经获取到，比如通过 MouseMove 事件
            //    int mouseX = mousePosition.X;
            //    // 遍历所有通道
            //    for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            //    {
            //        if (this.channels[i].isEnable)
            //        {
            //            // 计算 timeStep
            //            double timeStep = 10.0 * TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade);
            //            // 计算 mouseMoment
            //            double mouseMoment = this.windowCenterTime - timeStep / 2.0 + (double)mousePosition.X / (double)this.centerDrawArea.ClientSize.Width * timeStep;
            //            // 获取通道的曲线数据
            //            var data = this.channels[i].channel.GetCurves()[0];

            //            if (data != null && data.CurvePoints != null)
            //            {
            //                // 判断是否有 X 坐标在 mouseX ± 10 范围内的点
            //                var nearbyPoints = data.CurvePoints.Where(o => (o.X >= mouseX - 0.1) && (o.X <= mouseX + 0.1)).ToList();

            //                if (nearbyPoints.Any())
            //                {
            //                    var index = data.CurvePoints.ToList().IndexOf(nearbyPoints[0]);


            //                    // 初始化数据变量
            //                    double dataValue = 0.0;
            //                    bool isInterpolated = false;

            //                    // 获取数据
            //                    bool hasData = this.channels[i].channel.GetDataFromChannelBuffer2(mouseMoment, new PointF((nearbyPoints[0].X), nearbyPoints[0].Y), ref dataValue, ref isInterpolated);
            //                    if (hasData)
            //                    {
            //                        float y = this.CalculateScreenYPosition(dataValue, i);
            //                        //if (index != -1 && data.curvePointsValues.Length > 0)
            //                        //{
            //                        //    var DoubleOriginal = data.curvePointsValues[index];
            //                        //    dataValue = DoubleOriginal;
            //                        //}
            //                        channelData.Add((i + 1, dataValue, isInterpolated, new Point((int)(nearbyPoints[0].X), (int)y)));
            //                    }

            //                }

            //            }
            //        }
            //    }
            //}
            //catch (System.Exception)
            //{

            //}

        }
        void ShowOrignalDataV1(Point mousePosition)
        {

            //try
            //{
            //    // 假设 mousePosition.X 已经获取到，比如通过 MouseMove 事件
            //    int mouseX = mousePosition.X;
            //    // 遍历所有通道
            //    for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            //    {
            //        if (this.channels[i].isEnable)
            //        {
            //            // 计算 timeStep
            //            double timeStep = 10.0 * TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade);
            //            // 计算 mouseMoment
            //            double mouseMoment = this.windowCenterTime - timeStep / 2.0 + (double)mousePosition.X / (double)this.centerDrawArea.ClientSize.Width * timeStep;
            //            // 获取通道的曲线数据
            //            var data = this.channels[i].channel.GetCurves()[0];

            //            if (data != null && data.CurvePoints != null)
            //            {
            //                // 判断是否有 X 坐标在 mouseX ± 10 范围内的点
            //                var nearbyPoints = data.CurvePoints.Where(o => (o.X >= mouseX - 0.1) && (o.X <= mouseX + 0.1)).ToList();

            //                if (nearbyPoints.Any())
            //                {
            //                    var index = data.CurvePoints.ToList().IndexOf(nearbyPoints[0]);


            //                    // 初始化数据变量
            //                    double dataValue = 0.0;
            //                    bool isInterpolated = false;

            //                    // 获取数据
            //                    float y = 0;
            //                    if (index != -1 && data.curvePointsValues.Length > 0)
            //                    {
            //                        var DoubleOriginal = data.curvePointsValues[index];
            //                        dataValue = DoubleOriginal + this.channels[i].channel.GetOffset();
            //                    }
            //                    channelData.Add((i + 1, dataValue, isInterpolated, new Point((int)(nearbyPoints[0].X), (int)y)));

            //                }

            //            }
            //        }
            //    }
            //}
            //catch (System.Exception)
            //{

            //}

        }
        void ShowOrignalData(Point mousePosition)
        {
            //try
            //{
            //    int mouseX = mousePosition.X;
            //    Console.WriteLine($"Mouse X Position: {mouseX}");

            //    for (int i = 0; i < OscilloscopeScreen.CHANNEL_COUNT; i++)
            //    {
            //        if (this.channels[i].isEnable)
            //        {
            //            Console.WriteLine($"Processing Channel {i + 1} - Enabled");

            //            // 计算 timeStep 和 mouseMoment
            //            double timeStep = 10.0 * TimePerCellAdjustGrade.Instance.GetValueOfGrade(this.timeLengthPerCellGrade);
            //            double mouseMoment = this.windowCenterTime - timeStep / 2.0 + (double)mousePosition.X / (double)this.centerDrawArea.ClientSize.Width * timeStep;
            //            Console.WriteLine($"Channel {i + 1} - TimeStep: {timeStep}, MouseMoment: {mouseMoment}");

            //            // 获取通道的曲线数据
            //            var data = this.channels[i].channel.GetCurves()[0];
            //            if (data != null && data.CurvePoints != null)
            //            {

            //                // 查找附近的点
            //                var nearbyPoints = data.CurvePoints.Where(o => (o.X >= mouseX - 0.1) && (o.X <= mouseX + 0.1)).ToList();
            //                Console.WriteLine($"Channel {i + 1} - NearbyPoints Count: {nearbyPoints.Count}");

            //                if (nearbyPoints.Any())
            //                {
            //                    // 获取最近点的索引

            //                    // 初始化数据变量
            //                    double dataValue = 0.0;
            //                    bool isInterpolated = false;

            //                    // 获取数据
            //                    bool hasData = this.channels[i].channel.GetDataFromChannelBuffer2(mouseMoment, new PointF(nearbyPoints[0].X, nearbyPoints[0].Y), ref dataValue, ref isInterpolated);
            //                    if (hasData)
            //                    {
            //                        Console.WriteLine($"Channel {i + 1} - DataValue: {dataValue}, IsInterpolated: {isInterpolated}");

            //                        float y = this.CalculateScreenYPosition(dataValue, i);
            //                        Console.WriteLine($"Channel {i + 1} - Screen Y Position: {y}");

            //                        // 添加数据到 channelData 列表中
            //                        channelData.Add((i + 1, dataValue, isInterpolated, new Point((int)nearbyPoints[0].X, (int)y)));
            //                        Console.WriteLine($"Channel {i + 1} - Added to channelData: (Channel: {i + 1}, DataValue: {dataValue}, IsInterpolated: {isInterpolated}, Point: ({(int)nearbyPoints[0].X}, {(int)y})");
            //                    }
            //                    else
            //                    {
            //                        Console.WriteLine($"Channel {i + 1} - No data found for mouse moment: {mouseMoment}");
            //                    }
            //                }
            //                else
            //                {
            //                    Console.WriteLine($"Channel {i + 1} - No nearby points found for mouse X: {mouseX}");
            //                }
            //            }
            //            else
            //            {
            //                Console.WriteLine($"Channel {i + 1} - CurvePoints is null or empty");
            //            }
            //        }
            //        else
            //        {
            //            Console.WriteLine($"Channel {i + 1} - Disabled");
            //        }
            //    }
            //}
            //catch (System.Exception ex)
            //{
            //    Console.WriteLine($"Exception caught: {ex.Message}");
            //}
        } 
        #endregion


        private float CalculateScreenYPosition(double dataValue, int channelIndex)
        {
            // 获取通道的基线位置和垂直刻度
            double baseLineValue = this.channels[channelIndex].channel.GetBaseLineValue();
            double valuePerCell = ValuePerCellAdjustGrade.Instance.GetValueOfGrade(this.channels[channelIndex].channel.GetValuePerCellGrade());

            // 计算数据值相对基线的位置
            double relativeValue = dataValue - baseLineValue;

            // 计算Y轴位置
            float y = (float)(this.centerDrawArea.ClientSize.Height / 2) - (float)(relativeValue / valuePerCell);

            // 确保Y轴位置在屏幕范围内
            if (y < 0)
            {
                y = 0;
            }
            else if (y > this.centerDrawArea.ClientSize.Height)
            {
                y = this.centerDrawArea.ClientSize.Height;
            }

            return y;
        }

        private void DrawDataOfMousePoints(Graphics g, List<(int ChannelNumber, double DataValue, bool IsInterpolated, Point ScreenPosition)> channelData)
        {
            float x = (float)OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left + (float)(base.ClientSize.Width - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Left - OscilloscopeScreen.CENTER_DRAW_AREA_MARGIN.Right) * 0.2f;
            float y = 0f;
            List<string> ChnnelDataStrings = new List<string>();
            List<(string, Color)> ChnnelDataColors = new List<(string, Color)>();
            foreach (var data in channelData)
            {
                SolidBrush solidBrush = new SolidBrush(this.channels[data.ChannelNumber - 1].channel.GetColor());
                var hexBinarystr = string.Empty;
                hexBinarystr = $"{Environment.NewLine}hex:0x{Convert.ToInt32(data.DataValue).ToString("X")} {Environment.NewLine}b:0b{Convert.ToString(Convert.ToInt32(data.DataValue), 2)}";
                ChnnelDataColors.Add(($"CH{data.ChannelNumber.ToString()}", solidBrush.Color));
                ChnnelDataStrings.Add(string.Concat(new string[]
                {
            "CH",
            data.ChannelNumber.ToString(),
            ":Data:",
            InternalUtils.GetDisplayStrOfValue(data.DataValue),
            data.IsInterpolated ? " (I)" : "",
            hexBinarystr,
                }));
                // 绘制数据点的标记（例如一个小圆点）
                g.FillEllipse(solidBrush, data.ScreenPosition.X - 3, data.ScreenPosition.Y - 3, 6, 6);

                y += 50f; // 每个通道的信息向下移动20像素
                solidBrush.Dispose();
            }
            ShowDatasChannel?.Invoke(ChnnelDataStrings, ChnnelDataColors);
        }

        public double getBaseLineValue(int channelIndex)
        {
            return this.channels[channelIndex].channel.GetBaseLineValue();
        }


        #endregion





        // Token: 0x0400003D RID: 61
        private IContainer components;

        // Token: 0x0400003E RID: 62
        private static readonly Padding CENTER_DRAW_AREA_MARGIN = new Padding(32, 20, 5, 60);

        // Token: 0x0400003F RID: 63
        private static readonly Color CENTER_DRAW_AREA_BACKGROUND = Color.Black;

        // Token: 0x04000040 RID: 64
        private static readonly Color OSCILLOSCOPE_SCREEN_BACKGROUND = Color.Black;

        // Token: 0x04000041 RID: 65
        public static int CHANNEL_COUNT = 4;

        // Token: 0x04000042 RID: 66
        private static readonly Font DEFAULT_M_FONT = new Font("Arial", 10f);

        // Token: 0x04000043 RID: 67
        private static readonly Font DEFAULT_V_G_FONT = new Font("Arial", 8f);

        // Token: 0x04000044 RID: 68
        private static readonly Font DEFAULT_V_P_FONT = new Font("Arial", 10f);

        // Token: 0x04000045 RID: 69
        private static readonly Font DEFAULT_V_A_FONT = new Font("Arial", 8f);

        // Token: 0x04000047 RID: 71
        private int verPosAdjustChannelSN = 1;

        // Token: 0x04000048 RID: 72
        private volatile int timeLengthPerCellGrade;

        // Token: 0x04000049 RID: 73
        private MouseTool mouseTool;

        // Token: 0x0400004A RID: 74
        private DrawArea centerDrawArea;

        // Token: 0x0400004B RID: 75
        private DrawArea topDrawArea;

        // Token: 0x0400004C RID: 76
        private DrawArea bottomDrawArea;

        // Token: 0x0400004D RID: 77
        private DrawArea leftDrawArea;

        // Token: 0x0400004E RID: 78
        private DrawArea rightDrawArea;

        // Token: 0x0400004F RID: 79
        private OscilloscopeScreen.ChannelContainer[] channels = new OscilloscopeScreen.ChannelContainer[OscilloscopeScreen.CHANNEL_COUNT];

        // Token: 0x04000050 RID: 80
        private double timeReferenceValue;

        // Token: 0x04000051 RID: 81
        private double windowCenterTime;

        // Token: 0x04000052 RID: 82
        private double allChannelBufferMaxTotalTime;

        // Token: 0x04000053 RID: 83
        private bool rangingEnabled;

        // Token: 0x04000054 RID: 84
        private int rangingMoffset;

        // Token: 0x04000055 RID: 85
        private int rangingVoffset;

        // Token: 0x04000056 RID: 86
        private bool isNeedShowDataOfMousePoint;

        // Token: 0x04000057 RID: 87
        private double dataOfMousePoint;


        // Token: 0x04000058 RID: 88
        private bool isDataFromInterpolation;

        // Token: 0x04000059 RID: 89
        private IChannelBufferManager channelBufferMgr;

        // Token: 0x0400005A RID: 90
        private VoscRefreshTimer timer;

        // Token: 0x0400005B RID: 91
        private bool isFreezeHorizontalMove;

        // Token: 0x0400005C RID: 92
        private bool isFreezeVerticalMove;

        // Token: 0x0400005D RID: 93
        private bool isCursorsFunctionEnable;

        // Token: 0x0400005E RID: 94
        private CursorMoveMode cursorXMoveMode = CursorMoveMode._1;

        // Token: 0x0400005F RID: 95
        private CursorMoveMode cursorYMoveMode = CursorMoveMode._1;

        // Token: 0x04000060 RID: 96
        private float cursorX1Pos;

        // Token: 0x04000061 RID: 97
        private float cursorX2Pos;

        // Token: 0x04000062 RID: 98
        private int lastCenterDrawAreaWidth;

        // Token: 0x04000063 RID: 99
        private float cursorY1Pos;

        // Token: 0x04000064 RID: 100
        private float cursorY2Pos;

        // Token: 0x04000065 RID: 101
        private int lastCenterDrawAreaHeight;

        // Token: 0x02000015 RID: 21
        private class ChannelContainer
        {
            // Token: 0x04000066 RID: 102
            public IChannel channel;

            // Token: 0x04000067 RID: 103
            public bool isEnable;
        }

        // Token: 0x02000016 RID: 22
        // (Invoke) Token: 0x060000F7 RID: 247
        private delegate void RefreshUiTimeoutHandler();


    }
}
